﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using PersianLocalization;
using Telerik.WinControls.UI.Localization;
using System.Windows.Forms;

namespace TelerikForms.PL
{
    public partial class PayAndReceiveItemForm : Telerik.WinControls.UI.RadForm
    {
        public PayAndReceiveItemForm()
        {
            InitializeComponent();
        }

        private void PayAndReceiveItemForm_Load(object sender, EventArgs e)
        {
            //ChequeManagement.Common.PayAndReceiveItem commonobj = new ChequeManagement.Common.PayAndReceiveItem();
            ChequeManagement.BLL.BLLPayAndRecieveItemFactory BLLfarctoryobj = new ChequeManagement.BLL.BLLPayAndRecieveItemFactory();
            DateTime dt = DateTime.Now;
            radGridView1.DataSource = BLLfarctoryobj.GetAll();
            if (radGridView1.CurrentRow.Cells[3].Value.ToString() != null)
            {
                bankNameTextbox.Text = radGridView1.CurrentRow.Cells[1].Value.ToString();
                barnchNameTextbox.Text = radGridView1.CurrentRow.Cells[2].Value.ToString();
                chequeNoTextbox.Text = radGridView1.CurrentRow.Cells[3].Value.ToString();
                DateOfissueTextbox.Text = radGridView1.CurrentRow.Cells[4].Value.ToString();
                accountNoTextbox.Text = radGridView1.CurrentRow.Cells[5].Value.ToString();
                amountTextbox.Text = radGridView1.CurrentRow.Cells[6].Value.ToString();
                payeeTextbox.Text = radGridView1.CurrentRow.Cells[7].Value.ToString();
                statusDropDownList.SelectedText = radGridView1.CurrentRow.Cells[8].Value.ToString();

            }
            else
            {
            }

        }

        private void enserafButton_Click(object sender, EventArgs e)
        {

        }

        private void PayAndReceiveItemForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult ANS = MessageBox.Show("آیا مایلید از برنامه خارج شوید؟", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
            if (ANS == DialogResult.Yes)
            {
                Environment.Exit(0);
            }
            else
            {
                e.Cancel = true;
            }

        }

        private void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
        {
            try
            {
                bankNameTextbox.Text = radGridView1.CurrentRow.Cells[1].Value.ToString();
                barnchNameTextbox.Text = radGridView1.CurrentRow.Cells[2].Value.ToString();
                chequeNoTextbox.Text = radGridView1.CurrentRow.Cells[3].Value.ToString();
                DateOfissueTextbox.Text = radGridView1.CurrentRow.Cells[4].Value.ToString();
                accountNoTextbox.Text = radGridView1.CurrentRow.Cells[5].Value.ToString();
                amountTextbox.Text = radGridView1.CurrentRow.Cells[6].Value.ToString();
                payeeTextbox.Text = radGridView1.CurrentRow.Cells[7].Value.ToString();
                //statusDropDownList.SelectedText = null;
                //statusDropDownList.Items.Add(radGridView1.CurrentRow.Cells[8].Value.ToString());
                statusDropDownList.Text = radGridView1.CurrentRow.Cells[8].Value.ToString();
            }
            catch (Exception)
            {
            }


        }

        private void radGridView1_Enter(object sender, EventArgs e)
        {



        }

    }
}
